/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <cstdio>

using namespace std;
const int maxn=11;
int n,P[maxn],hash_table[maxn]={0};
char names[6][6]={"Jack","Linda","Bob","Lucy","John"};
void generateP(int index)
{
    if (index==n+1)
    {
        for (int i=0;i<=n ;++i )
        {
            printf("%s ",names[P[i]]);
        }
        putchar('\n');
        return;
    }
    for (int x=0;x<=n ;++x )
    {
        if (hash_table[x]==0)
        {
            P[index]=x;
            hash_table[x]=1;
            generateP(index+1);
            hash_table[x]=0;
        }
    }
}
int main_97()
{
    n=4;
    generateP(0);
	return 0;
}
